home *** CD-ROM | disk | FTP | other *** search
- public class Locale {
- private static final String[] LOCALE_CODE = new String[]{"EN", "DE", "FR", "IT", "ES"};
- private static final String[] LOCALE_NAME = new String[]{"English", "Deutsch", "Français", "Italiano", "Español"};
- private static int locale = initLocale();
-
- private static int initLocale() {
- String code = System.getProperty("microedition.locale").toUpperCase();
-
- int i;
- for(i = 0; i < LOCALE_CODE.length && !code.equals(LOCALE_CODE[i]); ++i) {
- }
-
- if (i == LOCALE_CODE.length) {
- i = 0;
- }
-
- return i;
- }
-
- public static String[] getSupportedLocales() {
- String[] locales = new String[LOCALE_CODE.length];
-
- for(int i = 0; i < LOCALE_CODE.length; ++i) {
- locales[i] = LOCALE_CODE[i] + " - " + LOCALE_NAME[i];
- }
-
- return locales;
- }
-
- public static int getCurrentLocale() {
- return locale;
- }
-
- public static String getLocaleName() {
- return LOCALE_NAME[locale];
- }
-
- public static String getLocaleCode() {
- return LOCALE_CODE[locale];
- }
- }
-